package com.wangfei.lecture;

public class Test {
    public static void main(String[] args) {
        Message message = name -> System.out.println("Hi, " + name);
        message.sayHello("wangfei");
    }

    interface Message {
        void sayHello(String name);
    }

    @org.junit.Test
    public void stringOverrideEquals(){

        String s1 = "aaa";
        String s2 = "aa" + new String("a");
        String s3 = new String("aaa");

        System.out.println(s1.intern().equals(s1));
        System.out.println(s1.intern().equals(s2));
        System.out.println(s3.intern().equals(s1));


        String str = new String("2");
        str.intern();
        String str2 = "2";
        System.out.println(str == str2);
//        System.out.println(str.intern() == str2);
    }
}
